package weapons;
import iterfaces.Ships;
import controllers.Map;
import controllers.Point;
import controllers.State;
import controllers.Waypoint;



/**
 * @author 508461
 * @version 1.0
 * @created 24-mei-2012 12:47:48
 */
public class MissileLauncher extends Weaponsystem {

	private Ships 			ship;
	private static final int MAGAZINE_SIZE 						= 1;
	private static final int MAX_HEALTHPOINTS_BEFORE_SHUTDOWN	= 40; //in %
	private static final int RELOAD_TIME 						= 30; //sec	
	private static final int MAGAZINE_AMOUNT 					= 20;
	private static final int FIRE_RATE 							= 1/30; //= 1 per keer 30 seconden
	private int remainingBullets;

	public static void main(String[] args){
		// Test de verbonden classes.
		new MissileLauncher();
	}
	
	public MissileLauncher(){
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	public MissileLauncher(Ships ship){
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		this.ship = ship;
		System.out.println("Instance " + this.getClass() + " created.");
	}
		
	public int getRemainingBullets(){
		return this.remainingBullets;
	}
	
	public void setRemainingBullets(int remainingBullets)
	{
		this.remainingBullets = remainingBullets;
	}
	
	public void shoot(Point point, Point shoot){
		Bullet missile = new Missile(this.ship.getPosition());
		missile.setDrawWaypoints(false);
		Map.getMap().addDrawAbleObject(missile);
		//Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1).addWaypoint(Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1), shoot);
		missile.addWaypoint(missile, shoot);
	}

	public void finalize() throws Throwable {
		super.finalize();
	}

}